(() => {
    class Animal {
        constructor(name, age) {
            this.name = name;
            this.age = age;
        }
        sayHello() {
            console.log(`${this.name}sayHello`);
        }
    }
    class Dog extends Animal {
        sayHello() {
            console.log("wangwangwang"); //子类覆盖掉父类的方法的形式叫重写
        }
    }
    class Cat extends Animal {
        run() {
            console.log(`${this.name}run`);
        }
    }
    const dog = new Dog("旺财", 5);
    const cat = new Cat("咪咪", 3);
    console.log("cat", cat);
    console.log("dog", dog);
    dog.sayHello();
    cat.sayHello();
    cat.run();
})();
